<?php

namespace app\common\model\mycurrency;

use addons\mycurrency\library\Common;
use app\common\model\User;
use think\Model;
use traits\model\SoftDelete;

class MerchantStoreEvaluate extends Model
{

    //use SoftDelete;

    

    // 表名
    protected $name = 'mycurrency_merchant_store_evaluate';

    const DISPLAY_STATUS_XIANSHI = 1 ;//前端显示状态  = 显示
    const DISPLAY_STATUS_YINCANG = 2 ;//前端显示状态  = 隐藏

    public function getPictureImagesAttr($value){
        $all = explode(',',$value);
        $baseUrl = Common::GetHost();
        foreach($all as $k => $v){
            $all[$k] = $baseUrl . $v;
        }
        return $all;
    }
    public function getAdminPicureImagesAttr($value){
        $all = explode(',',$value);
        $baseUrl = Common::GetHost();
        foreach($all as $k => $v){
            $all[$k] = $baseUrl . $v;
        }
        return $all;
    }

    public function getCreatetimeAttr($value){
        return $value != null ? date('Y-m-d', $value) : '';
    }

    //评价用户
    public function user()
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }

}
